package com.springapp.jsonmodel;

import com.springapp.model.Item;

/*
 * 
 * @uthor Sim4ik
 * 
 */

public class ItemJson {

	private String description;
	
	private Integer categoryId;
	
	private Double price;
	
	private String name;
	
	private Integer id;
	
	public ItemJson(){}
	
	public ItemJson(Integer id, 
			Integer categoryId, 
			Double price, 
			String description, 
			String name)
	{
		this.id = id;
		this.description = description;
		this.categoryId = categoryId;
		this.price = price;
		this.name = name;
	}
	
	public static ItemJson toModel(Item item){
		ItemJson ij = new ItemJson();
		ij.setCategoryId(item.getCathegory().getId());
		ij.setDescription(item.getDescription());
		ij.setId(item.getId());
		ij.setName(item.getName());
		ij.setPrice(item.getPrice());
		return ij;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Integer getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(Integer categoryId) {
		this.categoryId = categoryId;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
}
